/**
 * Created by mengweiqiang on 2017/4/28.
 */

function CheckChangePwd(UserIDCon) {
    $("#OldPassword").focus(function () {
        $("#PasswordCheckLabel").css("display",'none');
    }
    );
    var OldPassword = $("#OldPassword").val();
    var NewPassword1 = $("#NewPassword1").val();
    var NewPassword2 = $("#NewPassword2").val();
    if(OldPassword.length!=0&&NewPassword1.length!=0&&NewPassword2!=0) {

        if (OldPassword != NewPassword1) {
            if (NewPassword1 != NewPassword2) {
                alert("前后输入的密码不一致!");
                $("#NewPassword2").focus();
                return false;
            }
            else
            {
                $.ajax({
                    url: "/user/ajaxCheckOldPassword?UserID='"+UserIDCon+"'&UserPwd='"+OldPassword+"'",
                    type:"post",
                    success:function (data) {
                        if(data == "false")
                        {
                            $("#PasswordCheckLabel").css("display",'block');
                            return false
                        }
                        if(data = "true")
                        {
                            $("#ChangePasswordForm").submit();
                        }
                    }

                })
            }
        }
        else {
            alert("新密码不能与旧密码相同!");
            $("#NewPassword1").focus();
            return false;
        }
    }
    else
    {
        alert("新旧密码框均不能为空");
        return false;
    }
}
